﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CustomerDetailPage.aspx.cs" Inherits="pages_member_CustomerDetailPage" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>会员详细信息</title>
    <script type="text/javascript" src="../../scripts/jquery/jquery-1.4.2.js"></script>
    <script type="text/javascript" src="../../scripts/system/member.js"></script>
    <link rel="stylesheet" type="text/css" href="../../css/main.css"/>
    <style type="text/css">
        .style1
        {
            width: 223px;
        }
    </style>
    <script type="text/javascript">
        var tbody;
        function GetExts() {
            var btn = document.getElementById("ExtButton");
            if (btn.value == "查看扩展信息") {
                if (tbody) {
                    var extDetail = document.getElementById("extDetail");
                    extDetail.appendChild(tbody);
                }
                else {
                    var customerId = document.getElementById("cid").value;
                    CustomerWebService.GetCustomerExtendDetail(customerId, OnRequestComplete, OnError);
                }
                btn.setAttribute("value", "隐藏扩展信息");
            }
            else {
                var extDetail = document.getElementById("extDetail");
                extDetail.removeChild(tbody);
                btn.setAttribute("value", "查看扩展信息");
            }

        }
        function OnRequestComplete(result) {
            var extDetail = document.getElementById("extDetail");
            tbody = document.createElement("tbody");
            if (result && result.length > 0) {
                for (var n = 0; n < result.length; n++) {
                    var trEl = document.createElement("tr");

                    var td1 = document.createElement("td");
                    td1.setAttribute("align", "center");
                    td1.appendChild(document.createTextNode(result[n].ExtName));
                    trEl.appendChild(td1);

                    var td2 = document.createElement("td");
                    td2.appendChild(document.createTextNode(result[n].ExtValue));
                    trEl.appendChild(td2);

                    tbody.appendChild(trEl);
                }
            }
            else {
                var trEl = document.createElement("tr");

                var td1 = document.createElement("td");
                td1.setAttribute("align", "center");
                td1.setAttribute("colspan", "2");
                td1.appendChild(document.createTextNode("无扩展信息"));
                trEl.appendChild(td1);
                tbody.appendChild(trEl);
            }
            extDetail.appendChild(tbody);
        }

        function OnError(result) {
            alert("出错啦！【" + result + "】");
        }

 </script>
</head>
<body>
    <form id="form1" runat="server">
    <input id="cid" type="hidden" runat="server" />
    <asp:ScriptManager ID="ScriptManager1" runat="server">
        <Services>
            <asp:ServiceReference Path="~/webServiceASMX/CustomerWebService.asmx" />
        </Services>
    </asp:ScriptManager>
    <asp:ObjectDataSource ID="SourceCustomerLevel" runat="server" 
        DataObjectTypeName="CustomerLevelDetail" 
        DeleteMethod="DeleteEmployees" OldValuesParameterFormatString="original_{0}" 
        SelectMethod="GetEmployees" TypeName="CustomerLevelDB" 
        UpdateMethod="UpdateEmployees"></asp:ObjectDataSource>
    <table width="730" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="34" style="background-image:../../images/bj2.gif"><strong>&nbsp;&nbsp;&nbsp;&nbsp;会员详细信息</strong></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>
          <table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td>&nbsp;</td>
            </tr>
            <tr>
                <td>
                  <table width="685" border="1" align="center" cellpadding="5" style="background-color:#999999">
                    <tr>
                      <td align="center" class="style1">会员名称:</td>
                      <td>
                        <asp:TextBox ID="CustomerNameTextBox" runat="server" Enabled="False"></asp:TextBox>
                       </td>
                    </tr>
                    <tr>
                      <td align="center" class="style1">邮箱:</td>
                      <td>
                        <asp:TextBox ID="EmailTextBox" runat="server" Enabled="False"></asp:TextBox>
                       </td>
                    </tr>
                    <tr>
                      <td align="center" class="style1">等级:</td>
                      <td>
                          <asp:DropDownList ID="LevelDropDownList" runat="server" 
                              DataSourceID="SourceCustomerLevel" DataTextField="LevelName" 
                              DataValueField="LevelId" Enabled="False">
                          </asp:DropDownList>
                       </td>
                    </tr>
                    <tr>
                      <td align="center" class="style1">性别:</td>
                      <td>
                          <asp:DropDownList ID="GenderDropDownList" runat="server" Enabled="False">
                            <asp:ListItem Selected="True">男</asp:ListItem>
                            <asp:ListItem>女</asp:ListItem>
                          </asp:DropDownList>
                       </td>
                    </tr>
                    <tr>
                      <td align="center" class="style1">联系电话:</td>
                      <td>
                        <asp:TextBox ID="PhoneTextBox" runat="server" Enabled="False"></asp:TextBox>
                       </td>
                    </tr>
                  </table>
              </td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>
          </table>
          </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td align="center">
        <input id="ExtButton" onclick="GetExts();" type="button" value="查看扩展信息" /></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td><table id="extDetail" width="685" border="1" align="center" cellpadding="5" style="background-color:#999999"></table></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>
        <div align="center">
            <asp:ImageButton ID="ModifyImageButton" runat="server" 
                ImageUrl="~/images/an10.gif" onclick="ModifyImageButton_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:ImageButton ID="DeleteImageButton" runat="server" 
                ImageUrl="~/images/an9.gif" onclick="DeleteImageButton_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:ImageButton ID="ReturnImageButton" runat="server" 
                ImageUrl="~/images/an12.gif" PostBackUrl="~/pages/member/MemberOperation.aspx" />
        </div>
        </td>
      </tr>
    </table>
    </form>
</body>
</html>
